<template>
  <div class="question_pages">
    <div class="pages_content" v-if="questionData != false">
      <div class="cart-list">
        <van-swipe-cell :right-width="65" v-for="(item,index) in questionData" :key="index">
          <van-cell-group>
            <van-cell :title="item.content" value=""/>
          </van-cell-group>
          <span slot="right" @click="deleteItem(item.interlocutionId, index)">删除</span>
        </van-swipe-cell>
      </div>
    </div>
    <div class="page_kong" v-else>
      <img src="../../../src/assets/img/user/GroupCopy@2x.png" alt="暂无">
      <p>暂无信息</p>
    </div>
  </div>
</template>

<script>
import marketService from 'SERVICE/marketService'
export default {
  props: {
    questionData: { type: Array }
  },
  data() {
    return {
      startX: 0,
      endX: 0,
      id: '' //问答id
    }
  },
  methods: {
    //删除
    deleteItem(item, index) {
      // 当前索引
      // let index = e.currentTarget.dataset.index;
      this.$dialog
        .confirm({
          title: '确认删除？'
        })
        .then(() => {
          marketService.getqueryDelete({ interlocutionId: item }).then(result => {
            // 删除
            this.questionData.splice(index, 1)
          })
        })
        .catch(() => {})
    }
  }
}
</script>



<style lang="less" scoped>
/deep/ .van-swipe-cell__wrapper {
  .van-cell {
    height: 60px;
    line-height: 40px;
    .van-cell__title::before {
      content: '答';
      width: 22px;
      height: 22px;
      background: #488efb;
      margin-right: 10px;
      padding: 2px 6px;
      color: #fff;
      border-radius: 20%;
    }
  }
  .van-swipe-cell__right {
    color: #fff;
    font-size: 15px;
    width: 65px;
    height: 60px;
    display: inline-block;
    text-align: center;
    line-height: 60px;
    background-color: #f44;
  }
}
.question_pages {
  background: #ffffff;
  .page_kong {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 105px;
    img {
      width: 88px;
      height: 88px;
    }
    p {
      font-size: 12px;
      color: #999999;
    }
  }
}
</style>

 